<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="renderer" content="webkit">
  <title>页面</title>
  <link href="<@toParam code="PATH"/>/hplus/css/bootstrap.min.css" rel="stylesheet">
  <link href="<@toParam code="PATH"/>/hplus/css/font-awesome.min.css" rel="stylesheet">
  <link href="<@toParam code="PATH"/>/hplus/css/style.min.css" rel="stylesheet">
  <link href="<@toParam code="PATH"/>/hplus/css/plugins/ztree/metroStyle/metroStyle.css" rel="stylesheet">
  <link href="<@toParam code="PATH"/>/hplus/css/hsys.extend.css" rel="stylesheet">
</head>

<body>
	<div style="padding:10px">
		<form method="post" class="form-horizontal required-validate" action="saveRole" novalidate="novalidate" onsubmit="return validateCallback(this,dialogAjaxDone)">
			<input type="hidden" name="portalRole.id" value="${portalRole.id!}"/>
			<div class="form-group">
	    	<label class="col-xs-3 control-label">名称：</label>
	      <div class="col-xs-8">
	      	<input type="text" class="form-control required" name="portalRole.name" value="${portalRole.name!}"/>
	      </div>
	    </div>
			<div class="form-group">
	    	<label class="col-xs-3 control-label">描述：</label>
	      <div class="col-xs-8">
	      	<textarea rows="2" class="form-control" name="portalRole.remark">${portalRole.remark!}</textarea>
	      </div>
	    </div>
			<div class="form-group">
	    	<label class="col-xs-3 control-label">权限：</label>
	      <div class="col-xs-8">
	      	<input type="hidden" name="portalRole.rights" value="${portalRole.rights!}"/>
	      	<div class="ztree" id="ztree">
	      </div>
	    </div>
	    </div>
	    <div class="form-group">
	    	<div class="col-xs-8 col-xs-offset-3">
	      	<button type="submit" class="btn btn-primary">保存</button>
	      </div>
	    </div>
		</form>
	</div>
  <script src="<@toParam code="PATH"/>/hplus/js/jquery.min.js"></script>
  <script src="<@toParam code="PATH"/>/hplus/js/bootstrap.min.js"></script>
  <script src="<@toParam code="PATH"/>/hplus/js/plugins/validate/jquery.validate.min.js"></script>
  <script src="<@toParam code="PATH"/>/hplus/js/plugins/validate/messages_zh.min.js"></script>
  <script src="<@toParam code="PATH"/>/hplus/js/plugins/layer/layer.min.js"></script>
  <script src="<@toParam code="PATH"/>/hplus/js/plugins/ztree/jquery.ztree.all.min.js"></script>
  <script src="<@toParam code="PATH"/>/hplus/js/gcore_ext.js"></script>
	<script>
		var zNodes = ${rightsJSON!'[]'};
		var setting = {
				check:{
					enable:true
				},
				callback:{
					onCheck:function(event,treeId,treeNode){
						var treeObj = $.fn.zTree.getZTreeObj("ztree");
						var nodes = treeObj.getCheckedNodes(true);
						var str = "";
						$.each(nodes,function(index,item){
							str = str + item.rights+",";
						});
						if(str!=""){
							str = str.substring(0,str.length-1);
						}
						$("input[name='portalRole.rights']").val(str);
					}
				}
		};
		$(function(){
			$.fn.zTree.init($("#ztree"), setting, zNodes);
		});
	</script>
</body>
</html>
